
QL_TESTS = \
	quantlibtestsuite.cpp \
	americanoption.hpp americanoption.cpp \
	array.hpp array.cpp \
	asianoptions.hpp asianoptions.cpp \
	assetswap.hpp assetswap.cpp \
	autocovariances.hpp autocovariances.cpp \
	barrieroption.hpp barrieroption.cpp \
	basketoption.hpp basketoption.cpp \
	batesmodel.hpp batesmodel.cpp \
	bermudanswaption.hpp bermudanswaption.cpp \
	blackdeltacalculator.hpp blackdeltacalculator.cpp \
	blackformula.hpp blackformula.cpp \
	bonds.hpp bonds.cpp \
	brownianbridge.hpp brownianbridge.cpp \
	calendars.hpp calendars.cpp \
	capfloor.hpp capfloor.cpp \
	capflooredcoupon.hpp capflooredcoupon.cpp \
	cashflows.hpp cashflows.cpp \
	catbonds.hpp catbonds.cpp \
	cdo.hpp cdo.cpp \
	cdsoption.hpp cdsoption.cpp \
	chooseroption.hpp chooseroption.cpp \
	cliquetoption.hpp cliquetoption.cpp \
	cms.hpp cms.cpp \
	commodityunitofmeasure.hpp commodityunitofmeasure.cpp \
	compoundoption.hpp compoundoption.cpp \
	convertiblebonds.hpp convertiblebonds.cpp \
	covariance.hpp covariance.cpp \
	creditdefaultswap.hpp creditdefaultswap.cpp \
	curvestates.hpp curvestates.cpp \
	dates.hpp dates.cpp \
	daycounters.hpp daycounters.cpp \
	defaultprobabilitycurves.hpp defaultprobabilitycurves.cpp \
	digitalcoupon.hpp digitalcoupon.cpp \
	digitaloption.hpp digitaloption.cpp \
	distributions.hpp distributions.cpp \
	dividendoption.hpp dividendoption.cpp \
	europeanoption.hpp europeanoption.cpp \
	everestoption.hpp everestoption.cpp \
	exchangerate.hpp exchangerate.cpp \
	extendedtrees.hpp extendedtrees.cpp \
	fastfouriertransform.hpp fastfouriertransform.cpp \
	fdheston.hpp fdheston.cpp \
	fdmlinearop.hpp fdmlinearop.cpp \
	forwardoption.hpp forwardoption.cpp \
	functions.hpp functions.cpp \
	garch.hpp garch.cpp \
	gaussianquadratures.hpp gaussianquadratures.cpp \
	gjrgarchmodel.hpp gjrgarchmodel.cpp \
	gsr.hpp gsr.cpp \
	hestonmodel.hpp hestonmodel.cpp \
	himalayaoption.hpp himalayaoption.cpp \
	hybridhestonhullwhiteprocess.hpp hybridhestonhullwhiteprocess.cpp \
	inflation.hpp inflation.cpp \
	inflationcapfloor.hpp inflationcapfloor.cpp \
	inflationcapflooredcoupon.hpp inflationcapflooredcoupon.cpp \
    inflationcpibond.hpp inflationcpibond.cpp \
    inflationcpicapfloor.hpp inflationcpicapfloor.cpp \
	inflationcpiswap.hpp inflationcpiswap.cpp \
	inflationvolatility.hpp inflationvolatility.cpp \
	instruments.hpp instruments.cpp \
	integrals.hpp integrals.cpp \
	interestrates.hpp interestrates.cpp \
	interpolations.hpp interpolations.cpp \
	jumpdiffusion.hpp jumpdiffusion.cpp \
	libormarketmodel.hpp libormarketmodel.cpp \
	libormarketmodelprocess.hpp libormarketmodelprocess.cpp \
	linearleastsquaresregression.hpp linearleastsquaresregression.cpp \
	lookbackoptions.hpp lookbackoptions.cpp \
	lowdiscrepancysequences.hpp lowdiscrepancysequences.cpp \
	margrabeoption.hpp margrabeoption.cpp \
	marketmodel.hpp marketmodel.cpp \
	marketmodel_cms.hpp marketmodel_cms.cpp \
	marketmodel_smm.hpp marketmodel_smm.cpp \
	marketmodel_smmcapletalphacalibration.hpp marketmodel_smmcapletalphacalibration.cpp \
	marketmodel_smmcapletcalibration.hpp marketmodel_smmcapletcalibration.cpp \
	marketmodel_smmcaplethomocalibration.hpp marketmodel_smmcaplethomocalibration.cpp \
	markovfunctional.hpp markovfunctional.cpp \
	matrices.hpp matrices.cpp \
	mclongstaffschwartzengine.hpp mclongstaffschwartzengine.cpp \
	mersennetwister.hpp mersennetwister.cpp \
	money.hpp money.cpp \
	nthtodefault.hpp nthtodefault.cpp \
	ode.hpp ode.cpp \
	operators.hpp operators.cpp \
	optimizers.hpp optimizers.cpp \
	optionletstripper.hpp optionletstripper.cpp \
	overnightindexedswap.hpp overnightindexedswap.cpp \
	pagodaoption.hpp pagodaoption.cpp \
	pathgenerator.hpp pathgenerator.cpp \
	period.hpp period.cpp \
	piecewiseyieldcurve.hpp piecewiseyieldcurve.cpp \
	piecewisezerospreadedtermstructure.hpp piecewisezerospreadedtermstructure.cpp \
	quantooption.hpp quantooption.cpp \
	quotes.hpp quotes.cpp \
	rangeaccrual.hpp rangeaccrual.cpp \
	riskstats.hpp riskstats.cpp \
	rngtraits.hpp rngtraits.cpp \
	rounding.hpp rounding.cpp \
	sampledcurve.hpp sampledcurve.cpp \
	schedule.hpp schedule.cpp \
	shortratemodels.hpp shortratemodels.cpp \
	solvers.hpp solvers.cpp \
	spreadoption.hpp spreadoption.cpp \
	stats.hpp stats.cpp \
	surface.hpp surface.cpp \
	swap.hpp swap.cpp \
	swapforwardmappings.hpp swapforwardmappings.cpp \
	swaption.hpp swaption.cpp \
	swaptionvolatilitycube.hpp swaptionvolatilitycube.cpp \
	swaptionvolatilitymatrix.hpp swaptionvolatilitymatrix.cpp \
	swaptionvolstructuresutilities.hpp \
	swingoption.hpp swingoption.cpp \
	termstructures.hpp termstructures.cpp \
	timeseries.hpp timeseries.cpp \
	transformedgrid.hpp transformedgrid.cpp \
	tqreigendecomposition.hpp tqreigendecomposition.cpp \
	tracing.hpp tracing.cpp \
	twoassetbarrieroption.hpp twoassetbarrieroption.cpp \
	utilities.hpp utilities.cpp \
	variancegamma.hpp variancegamma.cpp \
	varianceoption.hpp varianceoption.cpp \
	varianceswaps.hpp varianceswaps.cpp \
	volatilitymodels.hpp volatilitymodels.cpp \
	vpp.hpp vpp.cpp \
	writerextensibleoption.hpp writerextensibleoption.cpp

QL_BENCHMARKS = \
	quantlibbenchmark.cpp \
	americanoption.hpp americanoption.cpp \
	asianoptions.hpp asianoptions.cpp \
	barrieroption.hpp barrieroption.cpp \
	basketoption.hpp basketoption.cpp \
	batesmodel.hpp batesmodel.cpp \
	convertiblebonds.hpp convertiblebonds.cpp \
	digitaloption.hpp digitaloption.cpp \
	dividendoption.hpp dividendoption.cpp \
	europeanoption.hpp europeanoption.cpp \
	fdheston.hpp fdheston.cpp \
	hestonmodel.hpp hestonmodel.cpp \
	interpolations.hpp interpolations.cpp \
	jumpdiffusion.hpp jumpdiffusion.cpp \
	lowdiscrepancysequences.hpp lowdiscrepancysequences.cpp \
	marketmodel_cms.hpp marketmodel_cms.cpp \
	marketmodel_smm.hpp marketmodel_smm.cpp \
	quantooption.hpp quantooption.cpp \
	riskstats.hpp riskstats.cpp \
	shortratemodels.hpp shortratemodels.cpp \
	utilities.hpp utilities.cpp

dist-hook:
	mkdir -p $(distdir)/build
	mkdir -p $(distdir)/bin
	cp -p $(srcdir)/bin/runtest.bat $(distdir)/bin
	rm -f $(distdir)/main.cpp

if BOOST_UNIT_TEST_FOUND

AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} ${BOOST_UNIT_TEST_DEFINE}

noinst_LTLIBRARIES = libUnitMain.la
libUnitMain_la_SOURCES = main.cpp
libUnitMain_la_CXXFLAGS = ${BOOST_UNIT_TEST_MAIN_CXXFLAGS}

main.cpp: Makefile.am
	echo "#ifdef BOOST_TEST_DYN_LINK" > $@
	echo "#include <boost/test/unit_test.hpp>" >> $@
	echo "#include <boost/test/framework.hpp>" >> $@
	echo "using namespace boost::unit_test;" >> $@
	echo "test_suite* init_unit_test_suite(int, char* []);" >> $@
	echo "bool init_function() {" >> $@
	echo "framework::master_test_suite().add(init_unit_test_suite(0,0));" >> $@
	echo "return true;" >> $@
	echo "}" >> $@
	echo "int main( int argc, char* argv[] ) {" >> $@
	echo "return ::boost::unit_test::unit_test_main( &init_function, argc, argv );" >> $@
	echo "}" >> $@
	echo "#endif" >> $@


if AUTO_BENCHMARK
bin_PROGRAMS = quantlib-test-suite quantlib-benchmark
else
bin_PROGRAMS = quantlib-test-suite
noinst_PROGRAMS = quantlib-benchmark
endif

quantlib_test_suite_SOURCES = ${QL_TESTS}
quantlib_test_suite_LDADD = libUnitMain.la ${top_builddir}/ql/libQuantLib.la \
                            -l${BOOST_UNIT_TEST_LIB}

quantlib_benchmark_SOURCES = ${QL_BENCHMARKS}
quantlib_benchmark_LDADD = libUnitMain.la ${top_builddir}/ql/libQuantLib.la \
                           -l${BOOST_UNIT_TEST_LIB}

TESTS = quantlib-test-suite$(EXEEXT)
TESTS_ENVIRONMENT = BOOST_TEST_LOG_LEVEL=message

.PHONY: benchmark
benchmark: quantlib-benchmark$(EXEEXT)
	BOOST_TEST_LOG_LEVEL=message ./quantlib-benchmark$(EXEEXT)

EXTRA_DIST = \
	README.txt \
	testsuite_vc8.vcproj \
	testsuite_vc9.vcproj \
	testsuite_vc10.vcxproj \
	testsuite_vc10.vcxproj.filters \
	testsuite_vc11.vcxproj \
	testsuite_vc11.vcxproj.filters \
	testsuite.dev

else

EXTRA_DIST = \
	${QL_TESTS} \
	quantlibbenchmark.cpp \
	README.txt \
	testsuite_vc8.vcproj \
	testsuite_vc9.vcproj \
	testsuite_vc10.vcxproj \
	testsuite_vc10.vcxproj.filters \
	testsuite_vc11.vcxproj \
	testsuite_vc11.vcxproj.filters \
	testsuite.dev

endif
